RAIS  3.2
C:/Projekte/RAIS/common/TranslationItem.cs
Go to the documentation of this file.
00001 
00028 using System;
00029 using System.Collections.Generic;
00030 using System.Data;
00031 using System.Text;
00032 
00033 namespace RAIS.Common.Localization
00034 {
00035     [Serializable]
00036         public class TranslationItem: DBObject
00037         {
00038                 #region Fields
00039                 Context context;
00040                 Culture sourceLanguage;
00041                 Culture targetLanguage;
00042                 string sourceText;
00043                 string targetText;
00044                 bool modified = false;
00045                 #endregion
00046                 #region Properties
00047 
00050                 new public string Name
00051                 {
00052                         get { return this.context.Name + " " + this.sourceText; }
00053                 }
00057                 public Context Context
00058                 {
00059                         get 
00060             { 
00061                 return this.context; 
00062             }
00063                 }
00067                 public string ContextName
00068                 {
00069                         get
00070                         {
00071                                 return this.Context.Name;
00072                         }
00073                 }
00077                 public Culture SourceLanguage
00078                 {
00079                         get 
00080             { 
00081                 return this.sourceLanguage; 
00082             }
00083                 }
00087                 public Culture TargetLanguage
00088                 {
00089                         get 
00090             { 
00091                 return this.targetLanguage; 
00092             }
00093                 }
00097                 public string SourceText
00098                 {
00099                         get { return this.sourceText; }
00100                 }
00104                 public string TargetText
00105                 {
00106                         get { return this.targetText; }
00107                         set 
00108                         {
00109                 if ((this.targetText == null && value == "") || (this.targetText == "" && value == null))
00110                     this.modified = false;
00111                 else
00112                     this.modified = this.targetText != value;
00113                 this.targetText = value;
00114                         }
00115                 }
00119                 public bool Modified
00120                 {
00121                         get { return this.modified; }
00122                         set { this.modified = value; }
00123                 }
00124                 #endregion
00125                 #region Constructors
00126                 public TranslationItem()
00127                 { }
00128                 public TranslationItem(IDataRecord record, Culture sourceLanguage, Culture targetLanguage)
00129                 {
00130                         this.ID = (int)record["PK Translation ID"];
00131                         this.context = new Context(record);
00132                         this.sourceLanguage = sourceLanguage;
00133                         this.targetLanguage = targetLanguage;
00134                         this.sourceText = record["SourceText"].ToString();
00135                         this.TargetText = record["TargetText"].ToString();
00136                 }
00137                 #endregion
00138         }
00139 }